package com.daxue.testconsumer.controller;

import com.daxue.testconsumer.service.TestConsumerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author wangxuedi
 * Date: 2020/4/23 14:48
 * describe:
 */
@RestController
@Slf4j
public class TestController {

    @Autowired
    public TestConsumerService testConsumerService;

    @GetMapping(value = "/test01")
    public String test01() {
        String s = testConsumerService.test01();
        return s;
    }

    @GetMapping(value = "/test02")
    public String test02() {
        try {
            String s = testConsumerService.aliPayService();
            return s;
        }catch (Exception e) {
            log.error(e.getMessage());
            return e.getMessage();
        }
    }

    @RequestMapping(value = "authRedirect")
    public void authRedirect(HttpServletRequest request) {
        String contextPath = request.getContextPath();
        log.info("current authRedirect is: " + request.toString());
    }







}
